package com.example.service.impl;

import com.example.mapper.DemoMapper;
import com.example.pojo.Account;
import com.example.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional
public class DemoServiceImpl implements DemoService {

    @Autowired
    private DemoMapper mapper;

    @Override
    public List<Account> listAccount() {
        return mapper.listAccount();
    }

    @Override
    public void updateAccount(Long cardNo, Long money) {
        mapper.updateAccount(cardNo, money);
    }

    public void transferMoney() {
        mapper.updateAccount(1001l, 700l);
        int i = 10/0;
        mapper.updateAccount(1002l, 100l);
        System.out.println("update success");
    }

    @Override
    public Map<String, Account> findMap() {
        return mapper.findMap();
    }


}
